import { ref } from "vue"
import {
		mainStore
	} from '@/store/index.js';
export function validateIsLogin (getUserInfoRef){
	const isLogin = ref(false);
	const isSetUserInfo = ref(false)
	// isLogin.value = 
	const validateLogin = ()=>{
		// 1:未登录|2登录了 没有设置个人信息|3登录了并且设置了个人信息 
		let type = 1;
		if(!mainStore().token){
			type=1
		}else if(mainStore().token&&(!mainStore().userInfo.nickName || !mainStore().userInfo.avatar || !mainStore().userInfo.userName)){
			type=3// type=2
		}else{
			type=3
		}
		if(type!==3){
			getUserInfoRef.value?.open(type)
			return false
		}
		
		return true
	}
	return{
		validateLogin
	}
}